package org.example.service.impl;

import org.example.dao.ItemDao;
import org.example.dao.impl.ItemDaoImpl;
import org.example.entity.Item;
import org.example.service.ItemService;

import java.util.ArrayList;
import java.util.List;

public class ItemServiceImpl implements ItemService {
    ItemDao itemDao=new ItemDaoImpl();

    public Item getPronameByordId(int ordId){
        Item item =itemDao.getProNameByOrderId(ordId);
        System.out.println(item);
        return null;
    }

    @Override
    public List<String> getProductNamesByOrderId(int orderId) {
        List<Item> items = itemDao.getItemsByOrderId(orderId);
        List<String> productNames = new ArrayList<>();
        for (Item item : items) {
            productNames.add(item.getProName());
        }
        return productNames;
    }
}
